package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zjsd.sqeybusiness.domain.Achieveold;
import com.zjsd.sqeybusiness.service.IAchieveoldService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 钉钉报的业绩
Controller
 *
 * @author Zheng
 * @date 2024-01-04
 */
@RestController
@RequestMapping("/sqeybusiness/achieveold")
public class AchieveoldController extends BaseController
{
    @Autowired
    private IAchieveoldService achieveoldService;

    /**
     * 查询钉钉报的业绩列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:achieveold:list')")
    @GetMapping("/list")
    public TableDataInfo list(Achieveold achieveold)
    {
        startPage();
        List<Achieveold> list = achieveoldService.selectAchieveoldList(achieveold);
        return getDataTable(list);
    }

    /**
     * 导出钉钉报的业绩
列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:achieveold:export')")
    @Log(title = "钉钉报的业绩", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Achieveold achieveold)
    {
        List<Achieveold> list = achieveoldService.selectAchieveoldList(achieveold);
        ExcelUtil<Achieveold> util = new ExcelUtil<Achieveold>(Achieveold.class);
        return util.exportExcel(list, "achieveold");
    }

    /**
     * 获取钉钉报的业绩
详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:achieveold:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(achieveoldService.selectAchieveoldById(id));
    }

    /**
     * 新增钉钉报的业绩

     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:achieveold:add')")
    //@Log(title = "钉钉报的业绩", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Achieveold achieveold)
    {
        return toAjax(achieveoldService.insertAchieveold(achieveold));
    }

    /**
     * 修改钉钉报的业绩

     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:achieveold:edit')")
    //@Log(title = "钉钉报的业绩", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Achieveold achieveold)
    {
        return toAjax(achieveoldService.updateAchieveold(achieveold));
    }

    /**
     * 删除钉钉报的业绩

     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:achieveold:remove')")
    //@Log(title = "钉钉报的业绩", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(achieveoldService.deleteAchieveoldByIds(ids));
    }
}
